home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 1.iso / HENSA / MATHS / PLPLOT / PLPLOT.ZIP / include / plplotX.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-28  |  4.2 KB  |  141 lines

  1. /* $Id: plplotX.h,v 1.12 1994/07/28 07:42:58 mjl Exp $
  2.  * $Log: plplotX.h,v $
  3.  * Revision 1.12  1994/07/28  07:42:58  mjl
  4.  * Eliminated old CADDR_T_HACK code.
  5.  *
  6.  * Revision 1.11  1994/07/20  04:03:47  mjl
  7.  * Eliminated include of plplot.h if it's already been included (this file
  8.  * uses a search path since it may be included into user code).
  9.  *
  10.  * Revision 1.10  1994/07/12  19:18:19  mjl
  11.  * Put CADDR_T_HACK code in proper location.
  12.  *
  13.  * Revision 1.9  1994/07/01  22:38:09  mjl
  14.  * All display-dependent data broken off into a separate structure.  The X
  15.  * driver now saves only one of these XwDisplay structs for each physical
  16.  * X display.  These are then shared between all PLplot streams.  This
  17.  * ensures that using multiple streams -> multiple X windows does not cause
  18.  * abnormal termination due to running out of resources since most are now
  19.  * shared (allocated colors, graphics contexts, etc).  The drawback is that
  20.  * colors are no longer independent between windows, if created by a single
  21.  * process (but this can also be an advantage).
  22. */
  23.  
  24. /*    plplotX.h
  25.  
  26.     Holds system header includes, prototypes of xwin driver
  27.     utility functions, and definition of the state structure.
  28. */
  29.  
  30. #ifndef __PLPLOTX_H__
  31. #define __PLPLOTX_H__
  32.  
  33. /* Several of the PLplot header files must be included first */
  34. /* I only do this conditionally because of the search path */
  35.  
  36. #ifndef __PLPLOT_H__
  37. #include <plplot.h>
  38. #endif
  39. #ifndef __PLSTREAM_H__
  40. #include <plstream.h>
  41. #endif
  42.  
  43. /* System headers */
  44.  
  45. #include <stdlib.h>
  46. #include <string.h>
  47. #include <sys/types.h>
  48.  
  49. #include <X11/Xlib.h>
  50. #include <X11/Xutil.h>
  51. #include <X11/cursorfont.h>
  52. #include <X11/keysym.h>
  53.  
  54. /* Specify max number of displays in use */
  55.  
  56. #define PLXDISPLAYS 100
  57.  
  58. /* One of these holds the display info, shared by all streams on a given */
  59. /* display */
  60.  
  61. typedef struct {
  62.     int        count;            /* Number of streams using display */
  63.     int        ixwd;            /* Specifies xwDisplay number */
  64.     char    *displayName;        /* Name of X display */
  65.     int        screen;            /* X screen */
  66.     Display    *display;        /* X display */
  67.     Visual    *visual;        /* X Visual */
  68.     GC        gc;            /* Graphics context */
  69.     Colormap    map;            /* Colormap */
  70.     unsigned    depth;            /* display depth */
  71.     int        color;            /* Set to 1 if a color output device */
  72.     int        ncol0;            /* Number of cmap 0 colors allocated */
  73.     int        ncol1;            /* Number of cmap 1 colors allocated */
  74.     XColor    cmap0[16];        /* Color entries for cmap 0 */
  75.     XColor    cmap1[256];        /* Color entries for cmap 1 */
  76.     XColor    fgcolor;        /* Foreground color (if grayscale) */
  77.     XColor    curcolor;        /* Current pen color */
  78. } XwDisplay;
  79.  
  80. /* One of these holds the X driver state information */
  81.  
  82. typedef struct {
  83.     XwDisplay    *xwd;            /* Pointer to display info */
  84.  
  85.     int        is_main;        /* Set if the toplevel X window */
  86.     Window    window;            /* X window id */
  87.     Pixmap    pixmap;            /* Off-screen pixmap */
  88.  
  89.     int        exit_eventloop;        /* Breaks the event loop when set */
  90.     long    init_width;        /* Initial window width */
  91.     long    init_height;        /* Initial window height */
  92.  
  93.     unsigned    width, height, border;    /* Current window dimensions */
  94.  
  95.     double    xscale_init;        /* initial pixels/lx (virt. coords) */
  96.     double    yscale_init;        /* initial pixels/ly (virt. coords) */
  97.     double    xscale;            /* as above, but current value */
  98.     double    yscale;            /*  (after possible resizing)  */
  99.  
  100.     short    xlen, ylen;        /* Lengths of device coord space */
  101.  
  102.     int        write_to_window;    /* Set if plotting direct to window */
  103.     int        write_to_pixmap;    /* Set if plotting to pixmap */
  104.  
  105.     void (*MasterEH) (PLStream *, XEvent *);    /* Master X event handler */
  106. } XwDev;
  107.  
  108. /*----------------------------------------------------------------------*\
  109. *        Function Prototypes
  110. \*----------------------------------------------------------------------*/
  111.  
  112. #ifdef __cplusplus
  113. extern "C" {
  114. #endif
  115.  
  116. /* Copies the supplied PLColor to an XColor */
  117.  
  118. void
  119. PLColor_to_XColor(PLColor *plcolor, XColor *xcolor);
  120.  
  121. /* Copies the supplied XColor to a PLColor */
  122.  
  123. void
  124. PLColor_from_XColor(PLColor *plcolor, XColor *xcolor);
  125.  
  126. /* Determines if we're using a monochrome or grayscale device */
  127.  
  128. int
  129. pl_AreWeGrayscale(Display *display);
  130.  
  131. /* Saves RGB components of given colormap */
  132.  
  133. void
  134. PLX_save_colormap(Display *display, Colormap map);
  135.  
  136. #ifdef __cplusplus
  137. }
  138. #endif
  139.  
  140. #endif    /* __PLPLOTX_H__ */
  141.